//
//  YMPDFDocument.h
//  TestDemo
//
//  Created by fengxijun on 16/6/23.
//  Copyright © 2016年 goappbox. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "YMPDFPage.h"
#import "YMPDFInfo.h"
#import "YMPDFCatalog.h"

extern NSString *errorCodeKey;

typedef NS_ENUM(NSUInteger,YQJPDFOpenStatus) {
    YMPDFOpenSuccess = 0,
    YMFileNotExists,
    YMNotPDF,
    YMPDFUrlNULL,
    YMPDFProviderNULL,
    YMPDFPasswordError,
    YMPDFNoData,
};

@interface YMPDFDocument : NSObject

//- (NSString *)GUID;

@property (nonatomic, strong) NSString *GUID;
@property (nonatomic, strong, readonly) YMPDFInfo *info;
@property (nonatomic, strong, readonly) YMPDFCatalog *catalog;
@property (nonatomic, strong, readonly) NSString *version;
@property (nonatomic, assign) NSUInteger totalPageCount;

- (instancetype) init NS_UNAVAILABLE;

- (instancetype) initWithfilepath:(NSString *)filepath
                         passowrd:(NSString *)password
                            error:(NSError **)error NS_DESIGNATED_INITIALIZER;

- (instancetype) initWithProvider:(CGDataProviderRef)provider
                         password:(NSString *)password
                            error:(NSError **)error NS_DESIGNATED_INITIALIZER;

@property (nonatomic, readonly) CGPDFDocumentRef document;

- (BOOL) isNeedsPassword;

- (YMPDFPage *)pageDataWithPage:(NSUInteger)page;

@end
